﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lesson17__练习题
{
    //真的鸭子嘎嘎叫 木头鸭子吱吱叫  橡皮鸭子急急叫 


    #region   继承父类鸭子叫
    class Duck
    {
    public virtual void Speak()
        {
            Console.WriteLine("真的鸭子嘎嘎叫");
        }
    }
    class WoodDuck:Duck
    {
        public override void Speak()
        {
            Console.WriteLine("木头鸭子吱吱叫 ");
        }
    }
    class RulerDuck : Duck
    {
        public override void Speak()
        {
            Console.WriteLine("橡皮鸭子叽叽叫");
        }
    }



    #endregion
    internal class Program
    {
        static void Main(string[] args)
        {

            Duck duck1  = new Duck();
            duck1.Speak() ;

            Duck duck2 = new WoodDuck();
            duck2 .Speak();

            Duck duck3= new RulerDuck();

            duck3.Speak(); 

        }
    }
}
